package com.sc.nft.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sc.nft.entity.dto.StatementConditionDTO;
import com.sc.nft.entity.vo.*;
import com.sc.nft.entity.vo.ecology.EcologyDataVO;
import com.sc.nft.enums.StatisticalStatementEnum;
import com.sc.nft.service.ReportOverviewService;
import com.sc.nft.service.StatementService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Service
@Slf4j
@RequiredArgsConstructor
public class StatementServiceImpl implements StatementService {

    private final ReportOverviewService reportOverviewService;

    @Override
    public CumulativePartVO cumulativePart(StatementConditionDTO statementConditionDTO) {

        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.ACCUMULATED_RED_ENVELOPES_USED.getCode());
        info.add(StatisticalStatementEnum.ACCUMULATED_RECHARGE.getCode());
        info.add(StatisticalStatementEnum.ACCUMULATED_RED_ENVELOPES_ISSUED.getCode());
        info.add(StatisticalStatementEnum.ACCUMULATED_COMMISSION_EXPENSES.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_SALES_VOLUME_OF_CITY_MASTER.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_RESIDENT_SALES_VOLUME.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_NUMBER_OF_AIRDROPPED_RESIDENTS.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_AIR_DROP_CITY_MASTER_SALES_VOLUME.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_RESIDENTS.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_CITY_LORDS.getCode());

        CumulativePartVO cumulativePartVO = new CumulativePartVO();
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        cumulativePartVO.setAccumulatedRedPacketsHaveBeenUsed(filterScreening(StatisticalStatementEnum.ACCUMULATED_RED_ENVELOPES_USED, reportOverviews));
        cumulativePartVO.setAccumulatedRecharge(filterScreening(StatisticalStatementEnum.ACCUMULATED_RECHARGE, reportOverviews));
        cumulativePartVO.setRedPacketsHaveBeenDistributedInTotal(filterScreening(StatisticalStatementEnum.ACCUMULATED_RED_ENVELOPES_ISSUED, reportOverviews));
        cumulativePartVO.setAccumulatedCommissionExpenses(filterScreening(StatisticalStatementEnum.ACCUMULATED_COMMISSION_EXPENSES, reportOverviews));
        cumulativePartVO.setCumulativeSalesVolumeOfCityMaster(filterScreening(StatisticalStatementEnum.CUMULATIVE_SALES_VOLUME_OF_CITY_MASTER, reportOverviews));
        cumulativePartVO.setCumulativeResidentSales(filterScreening(StatisticalStatementEnum.CUMULATIVE_RESIDENT_SALES_VOLUME, reportOverviews));
        cumulativePartVO.setCumulativeNumberOfAirdroppedResidents(filterScreening(StatisticalStatementEnum.CUMULATIVE_NUMBER_OF_AIRDROPPED_RESIDENTS, reportOverviews));
        cumulativePartVO.setCumulativeAirDropCityMasterSales(filterScreening(StatisticalStatementEnum.CUMULATIVE_AIR_DROP_CITY_MASTER_SALES_VOLUME, reportOverviews));
        cumulativePartVO.setCumulativeCompositeNumberOfResidents(filterScreening(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_RESIDENTS, reportOverviews));
        cumulativePartVO.setCumulativeCompositeNumberOfCityLords(filterScreening(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_CITY_LORDS, reportOverviews));
        return cumulativePartVO;
    }

    @Override
    public PlatformBalanceVO platformBalance(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.PLATFORM_RED_ENVELOPE_RED_ENVELOPE_BALANCE.getCode());
        info.add(StatisticalStatementEnum.TOTAL_BALANCE_OF_PLATFORM_ACCOUNT.getCode());

        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        PlatformBalanceVO platformBalanceVO = new PlatformBalanceVO();
        platformBalanceVO.setPlatformRedEnvelopeRedEnvelopeBalance(filterScreening(StatisticalStatementEnum.PLATFORM_RED_ENVELOPE_RED_ENVELOPE_BALANCE, reportOverviews));
        platformBalanceVO.setTotalBalanceOfPlatformAccount(filterScreening(StatisticalStatementEnum.TOTAL_BALANCE_OF_PLATFORM_ACCOUNT, reportOverviews));
        return platformBalanceVO;
    }

    @Override
    public ChargePartVO chargePart(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.TOTAL_AMOUNT_RECHARGED_BY_USERS_IN_ONE_DAY.getCode());
        info.add(StatisticalStatementEnum.TOTAL_AMOUNT_OF_TRANSFERS_APPROVED_IN_A_SINGLE_DAY.getCode());
        info.add(StatisticalStatementEnum.TOTAL_AMOUNT_SUCCESSFULLY_WITHDRAWN_IN_A_SINGLE_DAY.getCode());

        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        ChargePartVO chargePart = new ChargePartVO();
        chargePart.setDailyTopUpAmount(filterScreening(StatisticalStatementEnum.TOTAL_AMOUNT_RECHARGED_BY_USERS_IN_ONE_DAY, reportOverviews));
        chargePart.setSingleDayTransferAmount(filterScreening(StatisticalStatementEnum.TOTAL_AMOUNT_OF_TRANSFERS_APPROVED_IN_A_SINGLE_DAY, reportOverviews));
        chargePart.setAmountWithdrawnInASingleDay(filterScreening(StatisticalStatementEnum.TOTAL_AMOUNT_SUCCESSFULLY_WITHDRAWN_IN_A_SINGLE_DAY, reportOverviews));
        return chargePart;
    }

    @Override
    public InitialPublicOfferingsAndMarketingVO initialPublicOfferingsAndMarketing(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.SINGLE_DAY_SECONDARY_MARKET_TURNOVER.getCode());
        info.add(StatisticalStatementEnum.SINGLE_DAY_PRIMARY_MARKET_TURNOVER.getCode());
        info.add(StatisticalStatementEnum.TOTAL_PRIMARY_MARKET_SALES.getCode());
        info.add(StatisticalStatementEnum.TOTAL_BRAND_INCUBATION_SALES_USER.getCode());
        info.add(StatisticalStatementEnum.TOTAL_BRAND_INCUBATION_SALES_MARKET_VALUE.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_SALES_USERS.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_SALES_MARKET_VALUE.getCode());
        info.add(StatisticalStatementEnum.MARKET_SALES.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        InitialPublicOfferingsAndMarketingVO initialPublicOfferingsAndMarketing = new InitialPublicOfferingsAndMarketingVO();
        initialPublicOfferingsAndMarketing.setASingleDayIncludesSecondaryMarketTurnover(filterScreening(StatisticalStatementEnum.SINGLE_DAY_SECONDARY_MARKET_TURNOVER, reportOverviews));
        initialPublicOfferingsAndMarketing.setFirstDayPrimaryMarketTradingVolume(filterScreening(StatisticalStatementEnum.SINGLE_DAY_PRIMARY_MARKET_TURNOVER, reportOverviews));
        initialPublicOfferingsAndMarketing.setTotalPrimaryMarketTransactions(filterScreening(StatisticalStatementEnum.TOTAL_PRIMARY_MARKET_SALES, reportOverviews));
        initialPublicOfferingsAndMarketing.setTotalValueOfBrandIncubationSalesPurchasedByUsers(filterScreening(StatisticalStatementEnum.TOTAL_BRAND_INCUBATION_SALES_USER, reportOverviews));
        initialPublicOfferingsAndMarketing.setTotalMarketValueBrandIncubationSales(filterScreening(StatisticalStatementEnum.TOTAL_BRAND_INCUBATION_SALES_MARKET_VALUE, reportOverviews));
        initialPublicOfferingsAndMarketing.setUserFreeMarketSales(filterScreening(StatisticalStatementEnum.FREE_MARKET_SALES_USERS, reportOverviews));
        initialPublicOfferingsAndMarketing.setMarketCapFreeMarketSales(filterScreening(StatisticalStatementEnum.FREE_MARKET_SALES_MARKET_VALUE, reportOverviews));
        initialPublicOfferingsAndMarketing.setTotalSalesOfTheThreeMarketsExcludingMarketCapitalization(filterScreening(StatisticalStatementEnum.MARKET_SALES, reportOverviews));
        return initialPublicOfferingsAndMarketing;
    }

    @Override
    public TripartiteCommissionVO tripartiteCommission(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.TOTAL_THIRD_PARTY_FEES_GENERATED_IN_A_SINGLE_DAY.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        TripartiteCommissionVO tripartiteCommissionVO = new TripartiteCommissionVO();
        tripartiteCommissionVO.setServiceCharge(filterScreening(StatisticalStatementEnum.TOTAL_THIRD_PARTY_FEES_GENERATED_IN_A_SINGLE_DAY, reportOverviews));
        return tripartiteCommissionVO;
    }

    @Override
    public CashAndRedEnvelopesAreAwardedVO cashAndRedEnvelopesAreAwarded(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.THE_AMOUNT_OF_CASH_AWARDED_IN_A_SINGLE_DAY.getCode());
        info.add(StatisticalStatementEnum.THE_AMOUNT_OF_RED_PACKETS_AWARDED_IN_A_SINGLE_DAY.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        CashAndRedEnvelopesAreAwardedVO cashAndRedEnvelopesAreAwardedVO = new CashAndRedEnvelopesAreAwardedVO();
        cashAndRedEnvelopesAreAwardedVO.setCashIncentivesAreSetAside(filterScreening(StatisticalStatementEnum.THE_AMOUNT_OF_CASH_AWARDED_IN_A_SINGLE_DAY, reportOverviews));
        cashAndRedEnvelopesAreAwardedVO.setRedEnvelopeRewardsAreAllocated(filterScreening(StatisticalStatementEnum.THE_AMOUNT_OF_RED_PACKETS_AWARDED_IN_A_SINGLE_DAY, reportOverviews));
        return cashAndRedEnvelopesAreAwardedVO;
    }

    @Override
    public UserDataPartStatisticsVO userDataPartStatistics(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.NUMBER_OF_LORDS.getCode());
        info.add(StatisticalStatementEnum.NUMBER_OF_TOTAL_CITADELS.getCode());
        info.add(StatisticalStatementEnum.TOTAL_NUMBER_OF_INHABITANTS.getCode());
        info.add(StatisticalStatementEnum.TOTAL_NUMBER_OF_VISITORS.getCode());
        info.add(StatisticalStatementEnum.TOTAL_NUMBER_OF_USERS.getCode());
        info.add(StatisticalStatementEnum.THE_NUMBER_OF_NEW_CITY_MASTERS.getCode());
        info.add(StatisticalStatementEnum.NEW_RESIDENTS.getCode());
        info.add(StatisticalStatementEnum.NUMBER_OF_NEW_VISITORS.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        UserDataPartStatisticsVO userDataPartStatisticsVO = new UserDataPartStatisticsVO();
        userDataPartStatisticsVO.setNumberOfLords(filterScreening(StatisticalStatementEnum.NUMBER_OF_LORDS, reportOverviews));
        userDataPartStatisticsVO.setNumberOfTotalCitadels(filterScreening(StatisticalStatementEnum.NUMBER_OF_TOTAL_CITADELS, reportOverviews));
        userDataPartStatisticsVO.setTotalNumberOfInhabitants(filterScreening(StatisticalStatementEnum.TOTAL_NUMBER_OF_INHABITANTS, reportOverviews));
        userDataPartStatisticsVO.setTotalNumberOfVisitors(filterScreening(StatisticalStatementEnum.TOTAL_NUMBER_OF_VISITORS, reportOverviews));
        userDataPartStatisticsVO.setTotalNumberOfUsers(filterScreening(StatisticalStatementEnum.TOTAL_NUMBER_OF_USERS, reportOverviews));
        userDataPartStatisticsVO.setTheNumberOfNewCityMasters(filterScreening(StatisticalStatementEnum.THE_NUMBER_OF_NEW_CITY_MASTERS, reportOverviews));
        userDataPartStatisticsVO.setNewResidents(filterScreening(StatisticalStatementEnum.NEW_RESIDENTS, reportOverviews));
        userDataPartStatisticsVO.setNumberOfNewVisitors(filterScreening(StatisticalStatementEnum.NUMBER_OF_NEW_VISITORS, reportOverviews));
        return userDataPartStatisticsVO;
    }

    @Override
    public AirdropStatisticsVO airdropStatistics(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.CUMULATIVE_NUMBER_OF_AIRDROPPED_RESIDENTS.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_AIR_DROP_CITY_MASTER_SALES_VOLUME.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        AirdropStatisticsVO userDataPartStatisticsVO = new AirdropStatisticsVO();
        userDataPartStatisticsVO.setCumulativeNumberOfAirdroppedResidents(filterScreening(StatisticalStatementEnum.CUMULATIVE_NUMBER_OF_AIRDROPPED_RESIDENTS, reportOverviews));
        userDataPartStatisticsVO.setCumulativeAirDropCityMasterSales(filterScreening(StatisticalStatementEnum.CUMULATIVE_AIR_DROP_CITY_MASTER_SALES_VOLUME, reportOverviews));
        return userDataPartStatisticsVO;
    }

    @Override
    public SyntheticStatisticsVO syntheticStatistics(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_RESIDENTS.getCode());
        info.add(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_CITY_LORDS.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        SyntheticStatisticsVO syntheticStatisticsVO = new SyntheticStatisticsVO();
        syntheticStatisticsVO.setCumulativeCompositeNumberOfResidents(filterScreening(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_RESIDENTS, reportOverviews));
        syntheticStatisticsVO.setCumulativeCompositeNumberOfCityLords(filterScreening(StatisticalStatementEnum.CUMULATIVE_COMPOSITE_NUMBER_OF_CITY_LORDS, reportOverviews));
        return syntheticStatisticsVO;
    }

    @Override
    public TransactionDataVO primaryMarketTransactionData(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_ORDERS_IN_THE_PRIMARY_MARKET.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_TRANSACTION_AMOUNT_IN_THE_PRIMARY_MARKET.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_BUYERS.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_SELLER_USERS.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        TransactionDataVO transactionDataVO = new TransactionDataVO();
        transactionDataVO.setTransactionOrderNumber(filterScreening(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_ORDERS_IN_THE_PRIMARY_MARKET, reportOverviews));
        transactionDataVO.setTransactionAmount(filterScreening(StatisticalStatementEnum.FIRST_ORDER_TRANSACTION_AMOUNT_IN_THE_PRIMARY_MARKET, reportOverviews));
        transactionDataVO.setNumberOfTransactionBuyers(filterScreening(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_BUYERS, reportOverviews));
        transactionDataVO.setNumberOfSellers(filterScreening(StatisticalStatementEnum.FIRST_ORDER_NUMBER_OF_TRANSACTION_SELLER_USERS, reportOverviews));
        transactionDataVO.setTheAmountDeductedFromASingleDayTransaction(filterScreening(StatisticalStatementEnum.FIRST_ORDER_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES, reportOverviews));
        return transactionDataVO;
    }

    @Override
    public IncomeDataVO primaryIncome(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.FIRST_ORDER_DIRECT_REVENUE_ON_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_DAY_TO_DAY_EARNINGS.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_BREEDING_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FIRST_ORDER_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        IncomeDataVO incomeDataVO = new IncomeDataVO();
        incomeDataVO.setDirectRevenueOnTheDay(filterScreening(StatisticalStatementEnum.FIRST_ORDER_DIRECT_REVENUE_ON_THE_DAY, reportOverviews));
        incomeDataVO.setDayToDayEarnings(filterScreening(StatisticalStatementEnum.FIRST_ORDER_DAY_TO_DAY_EARNINGS, reportOverviews));
        incomeDataVO.setBreedingAwardOfTheDay(filterScreening(StatisticalStatementEnum.FIRST_ORDER_BREEDING_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setTeamContributionAwardOfTheDay(filterScreening(StatisticalStatementEnum.FIRST_ORDER_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setCityConsignmentDividendOnTheSameDay(filterScreening(StatisticalStatementEnum.FIRST_ORDER_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY, reportOverviews));
        return incomeDataVO;
    }

    @Override
    public TransactionDataVO freeSecondaryTradingData(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_TRANSACTION_AMOUNT.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION_BUYERS.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION_SELLER_USERS.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        TransactionDataVO transactionDataVO = new TransactionDataVO();
        transactionDataVO.setTransactionOrderNumber(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION, reportOverviews));
        transactionDataVO.setTransactionAmount(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_TRANSACTION_AMOUNT, reportOverviews));
        transactionDataVO.setNumberOfTransactionBuyers(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION_BUYERS, reportOverviews));
        transactionDataVO.setNumberOfSellers(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_NUMBER_OF_TRANSACTION_SELLER_USERS, reportOverviews));
        transactionDataVO.setTheAmountDeductedFromASingleDayTransaction(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES, reportOverviews));
        return transactionDataVO;
    }

    @Override
    public IncomeDataVO freeSecondaryIncomeData(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_DIRECT_REVENUE_ON_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_DAY_TO_DAY_EARNINGS.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_BREEDING_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.SECONDARY_MARKET_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        IncomeDataVO incomeDataVO = new IncomeDataVO();
        incomeDataVO.setDirectRevenueOnTheDay(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_DIRECT_REVENUE_ON_THE_DAY, reportOverviews));
        incomeDataVO.setDayToDayEarnings(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_DAY_TO_DAY_EARNINGS, reportOverviews));
        incomeDataVO.setBreedingAwardOfTheDay(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_BREEDING_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setTeamContributionAwardOfTheDay(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setCityConsignmentDividendOnTheSameDay(filterScreening(StatisticalStatementEnum.SECONDARY_MARKET_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY, reportOverviews));
        return incomeDataVO;
    }

    @Override
    public TransactionDataVO freeMarketTradingData(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_ORDERS_IN_THE_PRIMARY_MARKET.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_TRANSACTION_AMOUNT_IN_THE_PRIMARY_MARKET.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_BUYERS.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_SELLER_USERS.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        TransactionDataVO transactionDataVO = new TransactionDataVO();
        transactionDataVO.setTransactionOrderNumber(filterScreening(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_ORDERS_IN_THE_PRIMARY_MARKET, reportOverviews));
        transactionDataVO.setTransactionAmount(filterScreening(StatisticalStatementEnum.FREE_MARKET_TRANSACTION_AMOUNT_IN_THE_PRIMARY_MARKET, reportOverviews));
        transactionDataVO.setNumberOfTransactionBuyers(filterScreening(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_BUYERS, reportOverviews));
        transactionDataVO.setNumberOfSellers(filterScreening(StatisticalStatementEnum.FREE_MARKET_NUMBER_OF_TRANSACTION_SELLER_USERS, reportOverviews));
        transactionDataVO.setTheAmountDeductedFromASingleDayTransaction(filterScreening(StatisticalStatementEnum.FREE_MARKET_THE_AMOUNT_OF_MONEY_DEDUCTED_BY_RED_ENVELOPES, reportOverviews));
        return transactionDataVO;
    }

    @Override
    public IncomeDataVO recordFreeMarketReturns(StatementConditionDTO statementConditionDTO) {
        if (BeanUtil.isEmpty(statementConditionDTO)) {
            statementConditionDTO.setDay(7);
        }
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.FREE_MARKET_DIRECT_REVENUE_ON_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_DAY_TO_DAY_EARNINGS.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_BREEDING_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY.getCode());
        info.add(StatisticalStatementEnum.FREE_MARKET_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY.getCode());
        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(statementConditionDTO.getDay(), info);
        IncomeDataVO incomeDataVO = new IncomeDataVO();
        incomeDataVO.setDirectRevenueOnTheDay(filterScreening(StatisticalStatementEnum.FREE_MARKET_DIRECT_REVENUE_ON_THE_DAY, reportOverviews));
        incomeDataVO.setDayToDayEarnings(filterScreening(StatisticalStatementEnum.FREE_MARKET_DAY_TO_DAY_EARNINGS, reportOverviews));
        incomeDataVO.setBreedingAwardOfTheDay(filterScreening(StatisticalStatementEnum.FREE_MARKET_BREEDING_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setTeamContributionAwardOfTheDay(filterScreening(StatisticalStatementEnum.FREE_MARKET_TEAM_CONTRIBUTION_AWARD_OF_THE_DAY, reportOverviews));
        incomeDataVO.setCityConsignmentDividendOnTheSameDay(filterScreening(StatisticalStatementEnum.FREE_MARKET_CITY_CONSIGNMENT_DIVIDEND_ON_THE_SAME_DAY, reportOverviews));
        return incomeDataVO;
    }

    @Override
    public EcologyDataVO getEcologyData() {
        List<Integer> info = new ArrayList<>();
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_TOTAL_USER_INPUT.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_TOTAL_PLATFORM_DISTRIBUTION.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_CAST_TOTAL_FUEL_CONSUMED.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_CAST_USER_CONSUMED.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_YESTER_DAY_EXPEND_POINTS.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_HATCH_YESTER_DAY_ISSUE_POINTS.getCode());
        info.add(StatisticalStatementEnum.ECOLOGY_CAST_YESTER_DAY_EXPEND_POINTS.getCode());

        List<ReportOverviewVO> reportOverviews = reportOverviewService.obtainTheDataOfThePreviousDaysBasedOnTheDaysAndTypes(1, info);
        EcologyDataVO ecologyDataVO = new EcologyDataVO();
        ecologyDataVO.setTotalUserInput(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_TOTAL_USER_INPUT, reportOverviews));
        ecologyDataVO.setTotalPlatformDistribution(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_TOTAL_PLATFORM_DISTRIBUTION, reportOverviews));
        ecologyDataVO.setCastingConsumesFotalFuel(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_CAST_TOTAL_FUEL_CONSUMED, reportOverviews));
        ecologyDataVO.setTotalFueRemainingForUsers(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_CAST_USER_CONSUMED, reportOverviews));
        ecologyDataVO.setYesterdayFuel(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_YESTER_DAY_EXPEND_POINTS, reportOverviews));
        ecologyDataVO.setFuelReleaseYesterday(filterScreening(StatisticalStatementEnum.ECOLOGY_HATCH_YESTER_DAY_ISSUE_POINTS, reportOverviews));
        ecologyDataVO.setYesterdayCastingConsumedFuel(filterScreening(StatisticalStatementEnum.ECOLOGY_CAST_YESTER_DAY_EXPEND_POINTS, reportOverviews));
        return ecologyDataVO;
    }

    public static List<ReportOverviewVO> filterScreening(StatisticalStatementEnum statisticalStatementEnum, List<ReportOverviewVO> list) {
        return list.stream().filter(reportOverviewVO -> reportOverviewVO.getType().equals(statisticalStatementEnum.getCode())).collect(Collectors.toList());
    }

}
